<?php
// include the file containing initialization of the database and session
include_once('config.php');
include_once('model/friends.php');
include_once('model/friend_requests.php');

if (isset($_GET["id"]))
	$user_id = $_GET["id"];
else
	$user_id = Session::user()->id;

$logged_in_user_id = Session::user()->id;
$user = new Users();
$user->find_by_id($user_id);

$data = array (
	"logged_in" 	=> Session::is_logged_in(),
	"contents" 		=> "info_view.php",
	"user_id"		=> $user->id,
	"user"			=> $user,
	
	"is_friend"		=> Friends::are_friends_with($user_id, $logged_in_user_id),
	
	"has_request"   => FriendRequests::has_request($user_id, $logged_in_user_id),
);

$index_view = new Template('layout.php',$data);
$index_view->render();

?>